<?php

use think\Config;

return [
    'exception_handle' => function (Throwable $e) {
        $r = [
            'code' => 0,
            'msg'  => $e->getMessage(),
            'time' => time(),
            'data' => null,
        ];
        if (!Config::get('app_debug')) {
            $r['debug'] = [
                'line'  => $e->getLine(),
                'file'  => $e->getFile(),
                'trace' => $e->getTrace(),
            ];
        }
        return json($r);
    },
];